package com.ideal.hbase.client.mapper.impl;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;

import com.ideal.hbase.client.beans.Ideal3Info;
import com.ideal.hbase.client.core.mapper.RowMapper;

public class Ideal3Mapper implements RowMapper<Ideal3Info>{

	@Override
	public Ideal3Info mapRow(Result result, int rowNum) throws Exception {
		
        final Cell[] rawCells = result.rawCells();
        final Ideal3Info ideal3Info = new Ideal3Info();

        for (Cell cell : rawCells) {
        	final String rowkey = Bytes.toString(CellUtil.cloneRow(cell));
        	final String family = Bytes.toString(CellUtil.cloneFamily(cell));
        	final String qualifier = Bytes.toString(CellUtil.cloneQualifier(cell));
            final String value = Bytes.toString(CellUtil.cloneValue(cell));
            ideal3Info.setRowkey(rowkey);
            ideal3Info.setFamily(family);
            ideal3Info.setQualifier(qualifier);
            ideal3Info.setValue(value);
        }

        return ideal3Info;
	}


}
